import request from "./utils/request";
import { API_CONFIG } from "./config/api.config";

const authApi = {
  // 登录
  login(data) {
    return request({
      url: API_CONFIG.AUTH.LOGIN,
      method: "post",
      data,
    });
  },

  // 登出
  logout() {
    return request({
      url: API_CONFIG.AUTH.LOGOUT,
      method: "post",
    });
  },

  // 获取用户信息
  getUserInfo(data) {
    return request({
      url: API_CONFIG.USER.GET_INFO + "/" + data.userId + "/" + data.sysUserId,
      method: "get",
    });
  },

  // 刷新token
  refreshToken(token) {
    return request({
      url: API_CONFIG.AUTH.REFRESH_TOKEN,
      method: "post",
      data: { token },
    });
  },
};

export default authApi;
